<?php

use yii\helpers\Html;
use yii\grid\GridView;
use yii\widgets\Pjax;

$this->title = Yii::t('app.finance', 'Receive Accounts');
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="receive-account-index">

    <?php // echo $this->render('_search', ['model' => $searchModel]); ?>
    <h1 class="page-header"><small><?= Html::encode($this->title) ?></small>
    	<p class="pull-right"><?= Html::a(Yii::t('app.finance', 'Create Receive Account'), ['create'], ['class' => 'btn btn-success']) ?></p>
	</h1>
<?php Pjax::begin(); ?>    
	<?= GridView::widget([
        'dataProvider' => $dataProvider,
        'filterModel' => $searchModel,
        'columns' => [
            ['class' => 'yii\grid\SerialColumn'],

            //	'id',
			[
				'attribute' => 'type',
				'filter' =>  Yii::$app->params['finance_price_type'],
				'value' => function ($model) {
					return Yii::$app->params['finance_price_type'][$model->type];
				},
			],

            'account',
            'remark',
            //	'user.profile.name',
            [
                'attribute' => 'user_id',
                'value' => function ($model) { 
						$user = isset($model->user) ? $model->user->profile->name  : '' ;
						return $user;
					},
            ],
            'created_at',
            // 'updated_at',
            [
                'class' => 'yii\grid\ActionColumn',
                'template' =>"{view} {update}"
            ],
        ],
    ]); ?>
<?php Pjax::end(); ?></div>
